package ihs;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.texteditor.IAnnotationImageProvider;

public class InteractionHistoryMarker implements IAnnotationImageProvider {

	private static Image image;
	private static ImageRegistry imageRegistry;

	@Override
	public Image getManagedImage(Annotation annotation) {
		if (image == null) {
			image = ImageDescriptor.createFromFile(IHSPlugin.class,
					"violation.png").createImage(); //$NON-NLS-1$
			String key = Integer.toString(image.hashCode());
			getImageRegistry(Display.getCurrent()).put(key, image);
		}
		return image;
	}

	private ImageRegistry getImageRegistry(Display display) {
		if (imageRegistry == null)
			imageRegistry = new ImageRegistry(display);
		return imageRegistry;
	}

	@Override
	public String getImageDescriptorId(Annotation annotation) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public ImageDescriptor getImageDescriptor(String imageDescritporId) {
		// TODO Auto-generated method stub
		return null;
	}

}
